import request from '@/utils/request'

// 分页查询待处理的订单列表
export const getPendingList = (param, option) => {
  return request.get('/store/orders/pending-page', param, option)
}

// 查询订单详情
export const getOrderDetail = (orderId, option) => {
  return request.get(`/store/orders/${orderId}`, {}, option)
}

// 订单-全部订单分页查询
export const getOrderList = (param, option) => {
  return request.get('/store/orders/page', param, option)
}

// 气泡数量
export const countOrderNumber = () => {
  return request.get('/store/orders/tab-pop', {}, { load: false })
}

// 接单
export const receive = (param, option) => {
  return request.post('/store/orders/receive', param, option)
}

// 备货
export const prepare = (param, option) => {
  return request.post('/store/orders/prepare', param, option)
}

// 开始配送
export const start = (param, option) => {
  return request.post('/store/orders/deliveries/start', param, option)
}

// 配送完成
export const finish = (param, option) => {
  return request.post('/store/orders/deliveries/finish', param, option)
}

// 针对美团渠道查询订单详情中商品可退金额
export const getOrderDetailGoods = (param) => {
  return request.get('/store/refund-orders/details', param)
}

// 根据核销码获取详情
export const getVerifyDetail = (param) => {
  return request.get('/store/orders/verify/detail', param)
}

// 获取订单轨迹
export const getOrderTracks = (orderId, option) => {
  return request.get(`/store/orders/${orderId}/tracks`, {}, option)
}

// 扫码核销
export const orderVerify = (param) => {
  return request.post('/store/orders/users/pick', param)
}

// 批量打印
export const batchPrint = (param) => {
  return request.post('/store/orders/print/batch', param)
}

// 物流发货
export const logisticsDelivery = (param) => {
  return request.put('/store/orders/logistics-delivery', param)
}

// 获取指定订单下物流信息
export const getLogisticsDetail = (orderId, option) => {
  return request.get(`/store/orders/${orderId}/logistics`, {}, option)
}

// 查询消费有礼的券列表
export const getConsumeGiftCoupons = (orderId) => {
  return request.get(`/store/orders/${orderId}/consume-rebate-coupons`)
}

// 日志
export const logs = (param) => {
  return request.post('/store/orders/logs', param, { isPrompt: false, load: false })
}

// 各个状态订单数量
export const getTabPop = (param) => {
  return request.get(`/store/orders/tab-pop`, param, { load: false })
}
